/**
  ETFAna project, Anyang Normal University && IMP-CAS
  \class ETFDCTa
  \brief for DCs around the target
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-10-28
  \date 2021-11-21 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2021-10-28   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021-2024 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFDCTa_h
#define ETFDCTa_h

#include "ETFVDC.h"

class TClonesArray;
class ETFDCHit;

class ETFDCTa : public ETFVDC{
public:
  ETFDCTa(){}
  ETFDCTa(const char *name);
  virtual ~ETFDCTa();

  virtual void Initialize() override; ///< initialize the detector
  virtual void DrawHits() override; ///< draw the hits
  /// set the wire's projection to its normal plane
  virtual void SetHitProjection(ETFDCHit *h, DCType typeDC) override;
  virtual void Register() override; ///< register hits to the main output tree
  virtual void PostAssign() override; ///< finish the processing of all the assigned data

  /// get the fired sense wire layer
  /// \param type: XUV or XY, DC type; x12: X1 or X2
  virtual TClonesArray *GetHitsArray(DCType type, int x12) override;
  virtual void Print() override; ///< print the detector info
  double WireHitPosX() const{ return fWireHitPos[0]; }
  double WireHitPosY() const{ return fWireHitPos[1]; }
  double WireHitPos(int dcType) const{ return fWireHitPos[dcType%2]; }

  // ClassDef(ETFDCTa, 0);

protected:
  /// \param wireId: 0-16 (or 32) (both x1 and x2), along x increasing direction
  /// \param xy: 0-1
  virtual void AddHit(const ETFRawChannel *ch, int wireId, DCType typeDC) override;
  using ETFVDC::Filter;
  virtual void Filter() override; ///< filter all layers

  ///@{ the six layers of fired sense wires
  TClonesArray *fHits[2][2]; ///< [xy][x1-x2]
  // hit position using X(Y)[1,2]
  double fWireHitPos[2]; ///< [0-1]: [X-Y] - resolution: half Max Drift distance
};

#endif
